<?php
$server = new swoole_server('0.0.0.0',3333);
$server->set([
   'worker_num'=>2,
   'task_worker_num'=>2
]);
$server->on('receive',function ($ser,$fd,$reactor_id,$data){
    $ser->task($data,-1,function ($serv,$task_id,$data){
        echo "task---finish===".$data.PHP_EOL;
    });
});

$server->on("task",function ($ser,$fd,$reactor_id,$data){
    echo "task.....".$data.PHP_EOL;
    return 'task---success';
});

$server->on("finish",function ($serv,$task_id,$data){
    echo $data.PHP_EOL;
});

$server->start();